package com.example.qimo.ui

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.qimo.data.Bill
import com.example.qimo.repository.BillRepository
import kotlinx.coroutines.launch

class BillViewModel(private val repository: BillRepository) : ViewModel() {
    val allBills = repository.allBills

    fun addBill(bill: Bill) {
        viewModelScope.launch {
            repository.insert(bill)
        }
    }

    fun deleteBill(billId: Int) {
        viewModelScope.launch {
            repository.delete(billId)
        }
    }
}
